Skip to content

public Vote::setRanking

Read it at the source

Description

php
public Vote->setRanking ( array|string $ranking [, ?float $ownTimestamp = null] ): static

Set a new ranking for this vote.

Note that if your vote is already linked to one ore more elections, your ranking must be compliant with all of them, else an exception is throw. For do this, you need to use only valid Candidate object, you can't register a new ranking from string if your vote is already linked to an election.

Parameters

ranking: array|string

A Ranking. Have a look at the Wiki https://github.com/julien-boudry/Condorcet/wiki/II-%23-B.-Vote-management-%23-1.-Add-Vote to learn the available ranking formats.

ownTimestamp: ?float

Set your own timestamp metadata on Ranking. Your timestamp must be > than last registered timestamp. Else, an exception will be throw.

Throws:

  • CondorcetPHP\Condorcet\Throwable\VoteInvalidFormatException


Tutorial

Released under the MIT License.